/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "REQUEST_QUEUE", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RequestQueue.findAll", query = "SELECT r FROM RequestQueue r"),
    @NamedQuery(name = "RequestQueue.findByRequestId", query = "SELECT r FROM RequestQueue r WHERE r.requestId = :requestId"),
    @NamedQuery(name = "RequestQueue.findByRequestDetail", query = "SELECT r FROM RequestQueue r WHERE r.requestDetail = :requestDetail"),
    @NamedQuery(name = "RequestQueue.findByParam", query = "SELECT r FROM RequestQueue r WHERE r.param = :param"),
    @NamedQuery(name = "RequestQueue.findByReceivedTime", query = "SELECT r FROM RequestQueue r WHERE r.receivedTime = :receivedTime"),
    @NamedQuery(name = "RequestQueue.findByMsisdn", query = "SELECT r FROM RequestQueue r WHERE r.msisdn = :msisdn ORDER BY r.receivedTime DESC"),
    @NamedQuery(name = "RequestQueue.findByMsisdnInDateRange", query = "SELECT r FROM RequestQueue r WHERE (r.receivedTime BETWEEN :startDate AND :endDate) AND r.msisdn LIKE :msisdn"),
    @NamedQuery(name = "RequestQueue.getCpNumbers", query = "SELECT DISTINCT r.cpNumber FROM RequestQueue r ORDER BY r.cpNumber ASC"),
    @NamedQuery(name = "RequestQueue.findByCpNumber", query = "SELECT r FROM RequestQueue r WHERE r.cpNumber = :cpNumber"),
    @NamedQuery(name = "RequestQueue.findByServiceName", query = "SELECT r FROM RequestQueue r WHERE r.serviceName = :serviceName"),
    @NamedQuery(name = "RequestQueue.getServiceNames", query = "SELECT DISTINCT r.serviceName FROM RequestQueue r ORDER BY r.serviceName ASC"),
    @NamedQuery(name = "RequestQueue.findByStatus", query = "SELECT r FROM RequestQueue r WHERE r.status = :status"),
    @NamedQuery(name = "RequestQueue.findByLastCheckTime", query = "SELECT r FROM RequestQueue r WHERE r.lastCheckTime = :lastCheckTime"),
    @NamedQuery(name = "RequestQueue.findByCallBack", query = "SELECT r FROM RequestQueue r WHERE r.callBack = :callBack"),
    @NamedQuery(name = "RequestQueue.getDeliverProviders", query = "SELECT DISTINCT r.deliverProvider FROM RequestQueue r ORDER BY r.deliverProvider ASC"),
    @NamedQuery(name = "RequestQueue.findByDeliverProvider", query = "SELECT r FROM RequestQueue r WHERE r.deliverProvider = :deliverProvider"),
    @NamedQuery(name = "RequestQueue.findByResponseContent", query = "SELECT r FROM RequestQueue r WHERE r.responseContent = :responseContent")})
public class RequestQueue implements Serializable {

    @Column(name = "SELECTED")
    private BigInteger selected;
    @Size(max = 160)
    @Column(name = "OLD_CONTENT")
    private String oldContent;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "REQUEST_ID")
    private Long requestId;
    @Size(max = 400)
    @Column(name = "REQUEST_DETAIL")
    private String requestDetail;
    @Size(max = 400)
    @Column(name = "PARAM")
    private String param;
    @Column(name = "RECEIVED_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date receivedTime;
    @Size(max = 20)
    @Column(name = "MSISDN")
    private String msisdn;
    @Size(max = 10)
    @Column(name = "CP_NUMBER")
    private String cpNumber;
    @Size(max = 40)
    @Column(name = "SERVICE_NAME")
    private String serviceName;
    @Size(max = 40)
    @Column(name = "STATUS")
    private String status;
    @Column(name = "LAST_CHECK_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastCheckTime;
    @Size(max = 200)
    @Column(name = "CALL_BACK")
    private String callBack;
    @Size(max = 200)
    @Column(name = "DELIVER_PROVIDER")
    private String deliverProvider;
    @Size(max = 400)
    @Column(name = "RESPONSE_CONTENT")
    private String responseContent;
    @Transient
    private Date selectTime;
    @Transient
    private BigDecimal serviceSuggestionId;

    public RequestQueue() {
    }

    public RequestQueue(Long requestId) {
        this.requestId = requestId;
    }

    public Long getRequestId() {
        return requestId;
    }

    public void setRequestId(Long requestId) {
        this.requestId = requestId;
    }

    public String getRequestDetail() {
        return requestDetail;
    }

    public void setRequestDetail(String requestDetail) {
        this.requestDetail = requestDetail;
    }

    public String getParam() {
        return param;
    }

    public void setParam(String param) {
        this.param = param;
    }

    public Date getReceivedTime() {
        return receivedTime;
    }

    public void setReceivedTime(Date receivedTime) {
        this.receivedTime = receivedTime;
    }

    public String getMsisdn() {
        return msisdn;
    }

    public void setMsisdn(String msisdn) {
        this.msisdn = msisdn;
    }

    public String getCpNumber() {
        return cpNumber;
    }

    public void setCpNumber(String cpNumber) {
        this.cpNumber = cpNumber;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getLastCheckTime() {
        return lastCheckTime;
    }

    public void setLastCheckTime(Date lastCheckTime) {
        this.lastCheckTime = lastCheckTime;
    }

    public String getCallBack() {
        return callBack;
    }

    public void setCallBack(String callBack) {
        this.callBack = callBack;
    }

    public String getDeliverProvider() {
        return deliverProvider;
    }

    public void setDeliverProvider(String deliverProvider) {
        this.deliverProvider = deliverProvider;
    }

    public String getResponseContent() {
        return responseContent;
    }

    public void setResponseContent(String responseContent) {
        this.responseContent = responseContent;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (requestId != null ? requestId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RequestQueue)) {
            return false;
        }
        RequestQueue other = (RequestQueue) object;
        if ((this.requestId == null && other.requestId != null) || (this.requestId != null && !this.requestId.equals(other.requestId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "RequestQueue{" + "selected=" + selected + ", oldContent=" + oldContent + ", requestId=" + requestId + ", requestDetail=" + requestDetail + ", param=" + param + ", receivedTime=" + receivedTime + ", msisdn=" + msisdn + ", cpNumber=" + cpNumber + ", serviceName=" + serviceName + ", status=" + status + ", lastCheckTime=" + lastCheckTime + ", callBack=" + callBack + ", deliverProvider=" + deliverProvider + ", responseContent=" + responseContent + ", selectTime=" + selectTime + ", serviceSuggestionId=" + serviceSuggestionId + '}';
    }

    public BigInteger getSelected() {
        return selected;
    }

    public void setSelected(BigInteger selected) {
        this.selected = selected;
    }

    public String getOldContent() {
        return oldContent;
    }

    public void setOldContent(String oldContent) {
        this.oldContent = oldContent;
    }

    public Date getSelectTime() {
        return selectTime;
    }

    public void setSelectTime(Date selectTime) {
        this.selectTime = selectTime;
    }

    public BigDecimal getServiceSuggestionId() {
        return serviceSuggestionId;
    }

    public void setServiceSuggestionId(BigDecimal serviceSuggestionId) {
        this.serviceSuggestionId = serviceSuggestionId;
    }
}
